//
//  LYCustomAlertViewAction.swift
//  LYOnlineBanking
//
//  Created by 李永彬 on 2025/7/27.
//

import UIKit

enum LYAlertActionType {
    case obvious
    case unObvious
    
    func getTitleColor() -> UIColor {
        switch self {
        case .obvious:
            return UIColor(hex: "#FFFFFF")
        case .unObvious:
            return UIColor(hex: "#7F85A6")
        }
    }
    
    func getBackgroundColor() -> UIColor {
        switch self {
        case .obvious:
            return UIColor(hex: "#1E4FF3")
        case .unObvious:
            return UIColor(hex: "#DCE4FF")
        }
    }
}

class LYCustomAlertViewAction: NSObject {
    static func getButton(with title: String,
                          fontSize: CGFloat = 16.0,
                          cornerRadius: CGFloat = 22.0,
                          actionType: LYAlertActionType = .obvious) -> UIButton {
        // 创建自定义按钮
        let button = UIButton(type: .system)
        button.setTitle(title, for: .normal)
        button.titleLabel?.font = UIFont.boldSystemFont(ofSize: fontSize)
        button.setTitleColor(actionType.getTitleColor(), for: .normal)
        button.backgroundColor = actionType.getBackgroundColor()
        button.layer.cornerRadius = cornerRadius
        return button
    }
}

